package cn.bytets.rpc.api.headler;

import cn.bytets.rpc.api.Channel;

/**
 * 这里可以标注为SPI扩展类
 */
public interface ChannelHandler {

    /**
     * on channel connected.
     *
     * @param channel channel.
     */
    void connected(Channel channel);

    /**
     * on channel disconnected.
     *
     * @param channel channel.
     */
    void disconnected(Channel channel);

    /**
     * on message received.
     *
     * @param channel channel.
     * @param message message.
     */
    void received(Channel channel, Object message);

    /**
     * on exception caught.
     *
     * @param channel   channel.
     * @param exception exception.
     */
    void caught(Channel channel, Throwable exception);
}
